package yunhe.entity;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;

import yunhe.util.Global;

/**
 * 食物
 * 
 * @author Administrator
 *
 */
public class Food extends Point {
	/**
	 * 食物的出现
	 */
	public void showMe(Graphics g) {
		System.out.println("食物正在展示自己");
		g.setColor(Color.red);
		g.fill3DRect(x * Global.CELL_SIZE, y * Global.CELL_SIZE, Global.CELL_SIZE, Global.CELL_SIZE, true);
	}

	/**
	 * 蛇是否碰到食物
	 */
	public boolean isEatBySnake(Snake snake) {
		System.out.println("判断是否碰到食物");
		Point head=snake.getHead();
		if (this.equals(head)) {
			return true;
		}	
		return false;
	
	}

	public void addFood(Point p) {
		this.x = p.x;
		this.y = p.y;
	}

}
